cmake_minimum_required(VERSION 3.19)
project(crnn)

#add_definitions(-std=c++11)

option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)


set(CMAKE_CXX_STANDARD 14)
set(CMAKE_BUILD_TYPE Debug)


include_directories(${PROJECT_SOURCE_DIR}/include)


#OpenCV config
set(OpenCV_DIR /home/luotianhang/lib/opencv/usr/local/lib/cmake/opencv4)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
#add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
#CUDA config
find_package(CUDA 10.0 REQUIRED)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-std=c++14; -g; -G;-gencode; arch=compute_75;code=sm_75)
enable_language(CUDA)
include_directories(${CUDA_INCLUDE_DIRS})

#TensorRT config
include_directories(/home/luotianhang/下载/环境/TensorRT-7.0.0.11/include)
include_directories(/home/luotianhang/下载/环境/TensorRT-7.0.0.11/samples/common)
set(TENSORRT_LIB_PATH "/home/luotianhang/下载/环境/TensorRT-7.0.0.11/lib")
file(GLOB LIBS "${TENSORRT_LIB_PATH}/*.so")
link_directories(${TENSORRT_DIR}\\lib)


find_package(OpenCV QUIET
        NO_MODULE
        NO_DEFAULT_PATH
        NO_CMAKE_PATH
        NO_CMAKE_ENVIRONMENT_PATH
        NO_SYSTEM_ENVIRONMENT_PATH
        NO_CMAKE_PACKAGE_REGISTRY
        NO_CMAKE_BUILDS_PATH
        NO_CMAKE_SYSTEM_PATH
        NO_CMAKE_SYSTEM_PACKAGE_REGISTRY
        )



add_executable(crnn ${PROJECT_SOURCE_DIR}/main.cpp)
target_link_libraries(crnn nvinfer)
target_link_libraries(crnn cudart)


target_link_libraries(crnn ${OpenCV_LIBS})
target_link_libraries(crnn ${LIBS} ${CUDA_LIBRARIES})
#add_definitions(-O2 -pthread)